{include file="lib/header.html" type="check_identity" title="验证身份" }
  <div id="container">
    <div class="look-for-pwd">
      <div class="top">
        <ul class="clearfix">
          <li class="actived"><a href="javascript:void(0);"><span class="num">1</span>填写用户名<i class="arrow"></i></a></li>
          <li class="curr"><a href="javascript:void(0);"><span class="num">2</span>验证身份<i class="arrow"></i></a></li>
          <li><a href="javascript:void(0);"><span class="num">3</span>设置新密码<i class="arrow"></i></a></li>
          <li><a href="javascript:void(0);"><span class="num">4</span>完成</a></li>
        </ul>
      </div>
      <div class="steps">
      {if $username_type == 'email'}
        <div class="step3">
          <h2 class="tit"><i class="ok-icon"></i>确认邮件已发送至您的邮箱：{user_helper::hide_email($user_info.email)}，请访问邮箱验证</h2>
          <p class="btns"><a href="{AnUrl('')}" class="btn2 next-btn">返回到首页</a></p>
        </div>
      {else}
        <div class="step2">
          <h2 class="tit">请点击获取验证码并在手机：{user_helper::hide_mobile($user_info.mobile)} 中查看短信，并填写验证码</h2>
          <form action="{AnUrl('user/getback/set_newpass')}" method="post" id="js_passBtn">
            <input type="hidden" name="mobile" value="{$user_info.mobile}" />
            <p class="txt-box clearfix"><span class="txt-wrap"><input type="text" name="mobile_code" id="js_mobileCode" placeholder="请输入短信口令" class="txt txt1"/><span class="prompt hidden"><i class="false-icon"></i></span></span><a href="javascript:void(0);" class="btn1 validation-code clearfix"><em class="obtain" value="on">获取验证码</em></a></p>
            <p class="btns"><a href="javascript:void(0);" id="js_nextBtn" class="btn1 next-btn">下一步</a></p>
          </form>
        </div>
      {/if}
      </div>
        <!--end step3-->
      <!--end steps-->
    </div>
  </div>
</div>
<script>
$(function(){
  var mobileNext =  $('#js_mobileCode').next();
  $('.prompt').click(function(){
    $(this).hide();
  });
  $('#js_nextBtn').click(function(){
    var mobile_code = $.trim($('#js_mobileCode').val());
    if(mobile_code == '') {
        mobileNext.show().html('<i class="false-icon"></i>手机验证码不能为空');
        return ;
    }
    
    $.post(
        '{AnUrl("user/getback/set_newpass")}',
        { mobile_code:mobile_code, user_id:{$user_info.id} },
        function(data){
          if(data.info == 'error') {
            mobileNext.show().html('<i class="false-icon"></i>'+data.msg);
            return;
          } else {
            $('#js_passBtn').submit();
          }
        },'json');
  });
  //获取验证码
  $('.look-for-pwd .step2 .validation-code .obtain').click(function(){
      if($(this).attr('value') == 'on') {
        var time = 59;
        $('.look-for-pwd .step2 .validation-code .obtain').html(time).attr('value', 'off');
        var Timer=setInterval(function(){
          if(time > 0){
            time--;
            $('.look-for-pwd .step2 .validation-code .obtain').html(time).attr('value', 'off');
          } else {
            $('.look-for-pwd .step2 .validation-code .obtain').html('获取验证码').attr('value', 'on');
            clearInterval(Timer);
          }
        },1000);
      $.post(
          "{AnUrl('user/getback/get_mobile_code')}",
          { mobile:{$user_info.mobile}, 'send_type':'getback' },
          function(data){
            if(data.info == 'error') {
              mobileNext.show().html('<i class="false-icon"></i>'+data.msg);
            }
          },'json'
          );
      }
  });
  
});
</script>
{include file="lib/footer.html"}